#!/bin/zsh
set -eu
for candidate in /Library/Frameworks/Python.framework/Versions/Current/bin/python3 /opt/homebrew/bin/python3 /usr/local/bin/python3 /usr/bin/python3; do
  if [[ -x "$candidate" ]] && "$candidate" -c 'import sys; assert sys.version_info >= (3,9)' >/dev/null 2>&1; then
    exec "$candidate" "${0:A:h}/../Resources/updater.py" --restore
  fi
done
/usr/bin/osascript -e 'display dialog "Python 3.9以降が必要です。Pythonを導入してから再実行してください。" with title "LLMs Monitor 更新" buttons {"OK"}'
